This was reported in bug 600992.
g_object_unref (data);
break;
case ROW_TYPE_VOLUME:
- _gtk_file_system_volume_free (data);
+ _gtk_file_system_volume_unref (data);
break;
default:
break;
GFile *base_file;
base_file = _gtk_file_system_volume_get_root (volume);
- if (base_file != NULL && !g_file_is_native (base_file))
- {
- _gtk_file_system_volume_free (volume);
- continue;
- }
+ if (base_file != NULL)
+ {
+ if (!g_file_is_native (base_file))
+ {
+ g_object_unref (base_file);
+ continue;
+ }
+ else
+ g_object_unref (base_file);
+ }
}
}
ICON_COLUMN, pixbuf,
DISPLAY_NAME_COLUMN, display_name,
TYPE_COLUMN, ROW_TYPE_VOLUME,
- DATA_COLUMN, volume,
+ DATA_COLUMN, _gtk_file_system_volume_ref (volume),
IS_FOLDER_COLUMN, TRUE,
-1);
if (base_file)
g_object_unref (base_file);
- _gtk_file_system_volume_free (volume);
+ _gtk_file_system_volume_unref (volume);
if (label_text)
goto out;
GtkFileSystemVolume *volume;
volume = col_data;
- _gtk_file_system_volume_free (volume);
+ _gtk_file_system_volume_unref (volume);
}
- else
+ if (shortcut_type == SHORTCUT_TYPE_FILE)
{
GFile *file;
- g_assert (shortcut_type == SHORTCUT_TYPE_FILE);
-
file = col_data;
g_object_unref (file);
}
}
}
- shortcuts_insert_file (impl, start_row + n, SHORTCUT_TYPE_VOLUME, volume, NULL, NULL, FALSE, SHORTCUTS_VOLUMES);
+ shortcuts_insert_file (impl,
+ start_row + n,
+ SHORTCUT_TYPE_VOLUME,
+ _gtk_file_system_volume_ref (volume),
+ NULL,
+ NULL,
+ FALSE,
+ SHORTCUTS_VOLUMES);
n++;
}
if (shortcut_type == SHORTCUT_TYPE_SEPARATOR)
return FALSE;
else if (shortcut_type == SHORTCUT_TYPE_VOLUME)
- {
- return FALSE;
- }
+ return FALSE;
else if (shortcut_type == SHORTCUT_TYPE_FILE)
{
GFile *file;
_gtk_file_system_get_info (data->impl->file_system, data->file,
"standard::type",
shortcuts_activate_get_info_cb, data);
+
+ if (volume)
+ _gtk_file_system_volume_unref (volume);
}
static void
priv->volumes = g_slist_prepend (priv->volumes, g_object_ref (drive));
}
+
+ g_object_unref (drive);
}
g_list_free (drives);
/* see comment above in why we add an icon for a volume */
priv->volumes = g_slist_prepend (priv->volumes, g_object_ref (volume));
}
+
+ g_object_unref (volume);
}
/* add mounts that has no volume (/etc/mtab mounts, ftp, sftp,...) */
*/
if (mount_referenced_by_volume_activation_root (volumes, mount))
{
+ g_object_unref (mount);
continue;
}
/* show this mount */
priv->volumes = g_slist_prepend (priv->volumes, g_object_ref (mount));
+ g_object_unref (mount);
}
g_list_free (volumes);
if (error)
g_error_free (error);
+
+ _gtk_file_system_volume_unref (volume);
}
GCancellable *
return pixbuf;
}
+GtkFileSystemVolume *
+_gtk_file_system_volume_ref (GtkFileSystemVolume *volume)
+{
+ if (IS_ROOT_VOLUME (volume))
+ return volume;
+
+ if (G_IS_MOUNT (volume) ||
+ G_IS_VOLUME (volume) ||
+ G_IS_DRIVE (volume))
+ g_object_ref (volume);
+
+ return volume;
+}
+
void
-_gtk_file_system_volume_free (GtkFileSystemVolume *volume)
+_gtk_file_system_volume_unref (GtkFileSystemVolume *volume)
{
/* Root volume doesn't need to be freed */
if (IS_ROOT_VOLUME (volume))
gint icon_size,
GError **error);
-void _gtk_file_system_volume_free (GtkFileSystemVolume *volume);
+GtkFileSystemVolume *_gtk_file_system_volume_ref (GtkFileSystemVolume *volume);
+void _gtk_file_system_volume_unref (GtkFileSystemVolume *volume);
/* GtkFileSystemBookmark methods */
void _gtk_file_system_bookmark_free (GtkFileSystemBookmark *bookmark);
GTK_WIDGET (path_bar),
path_bar->icon_size,
NULL);
- _gtk_file_system_volume_free (volume);
+ _gtk_file_system_volume_unref (volume);
gtk_image_set_from_pixbuf (GTK_IMAGE (button_data->image), path_bar->root_icon);
break;